<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    	<meta name="renderer" content="webkit">
		<title>XXXX</title>
		<link rel="stylesheet" href="../../css/bootstrap.min.css" />
		<link rel="stylesheet" href="../../css/common.css" />
		<link rel="stylesheet" href="../../css/welcome.css" />
		<link rel="stylesheet" href="../../css/jquery.ptTimeSelect.css" /><!-- 日历样式 -->
		<link rel="stylesheet" href="../../css/validationEngine.jquery.css" /><!--表单验证css-->
		<link rel="stylesheet" href="../../css/joyride-2.1.css"/>
		<style type="text/css">
			.ofile {
			    position: absolute;
			    top:274px;
			    left:50px;
			    display: inline-block;
			    background: #feffff;
			    border: 1px solid #26a2f1;
			    padding: 4px 12px;
			    overflow: hidden;
			    color: #26a2f1;
			    text-decoration: none;
			    text-indent: 0;
			    line-height: 20px;
			}
			.ofile input {
			    position: absolute;
			    font-size: 16px;
			    right: 0;
			    top: 0;
			    opacity: 0;
			}
		</style>
		<script type="text/javascript" src="../../js/jquery-1.8.3.min.js" ></script>
		<script type="text/javascript" src="../../js/common.js"></script>
	</head>
	<body>
		<!--遮罩层-->
		<div class="zhy_zhezhao_pop " style="height:800px;"></div>
		<div class="zhy_popa dialog_1 " style="width: 450px;margin-left: -225px;display: none;">
			<p class="color66">请稍候...<span class="pull-right close_icon" onclick="hidePop()"></span></p>
			<div class="pop_content text-center">
				<img src="../../img/loading_load.gif" />
				<div style="height: 15px;"></div>
			  	<p>读取中，请稍候...</p>
			</div>
		</div>
		<!--遮罩层 end-->
		<div class="main_content add_block" >
		  <div class='div_bordered'>
		  	<div class="panel panel-default choose_block">
		  		<div class="panel-heading color333">添加长者</div>
		  		<div class="divider">
					<form id="successAddmember" action="../member/get_member_list?station=${serverStationCode}" method="get"></form>
					<form id="transformJdMemberExit" action="../reception/get_member_jd_list?station=${serverStationCode}&transform_state=0" method="get"></form>
					<input type="hidden" id="server_station_code" value="${serverStationCode}"/>
					<input type="hidden" id="selfCareBase" value="${member.selfCareBase }"/>
		  		</div>
		  		<form class="form-horizontal" style="position: absolute;top:18px;left: 650px;width:180px;">
					<div class="form-group tx-block">
						<div class="upload_img" style="width:auto">
							<input type="hidden" id="avatar_url1" value=""/>
							<div id="wait_loading">
								<img src="../../img/touxiang.jpg" width="180px" height="230px" id="avatar_url"/>
							</div>
							<a href="javascript:void(0);" class="ofile so-awesome1" style="color: #26a2f1;">上传头像
							    <input type="file" id="myFile" name="myFile"/>
							</a>
						</div>
				   </div>
				</form>
				<form class="form-horizontal old_block" id="old" role="form">
				   <c:if test="${member != null }">
				   	   <input type="hidden" id="member_id1" name="member_id1" value="${member.memberId }"/>
				   	   <input type="hidden" id="transform_state1" name="transform_state1" value="1"/>
				   </c:if>
				   <div class="form-group" >
				      <label for="name1" class="col-sm-2 control-label">姓名：</label>
				      <div class="col-sm-10">
				         <input type="text" class="form-control input150" id="name1" name="name1" placeholder="请输入姓名" value="XXX"/>
				         <em class="colorred">*</em>
				      </div>
				   </div>
				   <div class="form-group" >
				      	<label for="" class="col-sm-2 control-label">证件类型：</label>
				      	<div class="col-sm-10">
				         	<div class="btn-group inline " id="idType">
							   	<button type="button" class="btn btn-default dropdown-text" value="${empty member || empty member.IDType ? 0 : member.IDType}" style="width: 126px;">
							   		<c:choose>
							   			<c:when test="${member.IDType eq 1}">港澳通行证</c:when>
							   			<c:when test="${member.IDType eq 2}">台湾通行证</c:when>
							   			<c:when test="${member.IDType eq 3}">护照</c:when>
							   			<c:when test="${member.IDType eq 4}">军官证</c:when>
							   			<c:otherwise>身份证</c:otherwise>
							   		</c:choose>
							   	</button>
							   	<button type="button" class="btn btn-default dropdown-toggle">
							      	<span class="caret"></span>
							      	<span class="sr-only">切换下拉菜单</span>
							   	</button>
							   	<ul class="dropdown-menu" >
							      	<li><a value="0" href="javascript:void(0);">身份证</a></li>
							      	<li><a value="1" href="javascript:void(0);">港澳通行证</a></li>
							      	<li><a value="2" href="javascript:void(0);">台湾通行证</a></li>
							      	<li><a value="3" href="javascript:void(0);">护照</a></li>
							      	<li><a value="4" href="javascript:void(0);">军官证</a></li>
							   	</ul>
							</div>
				      	</div>
				   </div>
				   <div class="form-group" >
				      <label for="" class="col-sm-2 control-label">证件号码：</label>
				      <div class="col-sm-10">
				         <input type="text" class="form-control input300" id="id_card1" onblur="id_birthday('id_card1','birthday1')"
				            placeholder="证件号码" value="00000000"/>
				      </div>
				   </div>
				   <div class="form-group">
				      <label for="lastname" class="col-sm-2 control-label">性别：</label>
				      <div class="col-sm-10" id="sex1_1">
					      男
			          </div>
				   </div>
				   <div class="form-group" >
				      <label for="" class="col-sm-2 control-label">出生日期：</label>
				      <div class="col-sm-10">
				         <input type="text" input-type='date' class="form-control input150 validate[required]" id="birthday1" 
				            placeholder="出生日期" readonly="readonly"/>
				         <em class="colorred">*</em>
				      </div>
				   </div>
				   <div class="form-group" >
				      <label for="" class="col-sm-2 control-label">手机号码：</label>
				      <div class="col-sm-10">
				         <input type="text" class="form-control input300 validate[custom[mobile]]" id="phone1"
				            placeholder="手机号码" value="13501304397"/>
				      </div>
				   </div>
				   <div class="form-group">
						<label for="" class="col-sm-2 control-label">家庭座机：</label>
						<div class="col-sm-10">
							<input type="text" class="form-control input300 validate[custom[phone]]" id="telphone" value="62825252" placeholder="家庭座机"/>
						</div>
				   </div>
				   <div class="form-group mb0">
				   	    <label for="" class="col-sm-2 control-label">居住地址：</label>
						<div class="col-sm-10">
							<div id="jsAddress_0"  class="selectbox_l">
								<input type="hidden" class="province" value="${!empty province ? province:-1}"/>
								<input type="hidden" class="city" value="${!empty city ? city:-1}"/>
								<input type="hidden" class="area" value="${!empty area ? area:-1}"/>
								<div name="province" type="selectbox"  class="btn-group inline "></div>
								<div name="city" type="selectbox"  class="btn-group inline"></div>
								<div name="area" type="selectbox"  class="btn-group inline"></div>
							</div>
							<div class=" inline">
								<input type="text" class="form-control input300 validate[maxSize[32],required]" id="juzhu_address1" 
									placeholder="详细地址" value="111111"/>
								<em class="colorred">*</em>
							</div>
						</div>
				   </div>
			   	   <button type="button" class="btn btn_green2 so-awesome2" id="perfect_member">去完善详细信息&gt;</button>
				   <div class="form-group mb0">
				   	<div style="height: 50px;"></div>
				   	  <div class="divider"></div>
				      <div class="text-align:left;" id="setjoyRide">
						<button type="button" class="btn btn_green so-awesome3 ml0" id="member_load">读取</button>
						<button type="button" class="btn btn_green" id="member_add">保存</button>
						<button type="button" class="btn btn_whites" id="member_exit">取消</button>
				      </div>
				   </div>
				</form>
			</div>
		  </div>
		</div>
		<ol id="joyRideTipContent">
		    <li data-class="so-awesome1" data-text="我知道了"  data-options="tipLocation:left;">
		      <p>点击可上传头像，如使用读取功能将自动带出身份证内头像</p>
		    </li>
			<li data-class="so-awesome2" data-button="我知道了" >
		      <p>填入必填信息后，点此处去完善详细信息</p>
		    </li>
		    <li data-class="so-awesome3" data-text="我知道了"  data-options="tipLocation:left;">
		      <p>“读取”按钮需外接身份证识别设备。点击读取，可以读取身份信息自动填入</p>
		    </li>
		</ol>
		<script type="text/javascript" src="../../js/jquery.ptTimeSelect.js" ></script><!--日历插件-->
		<script type="text/javascript" src="../../js/pickday.js" ></script><!--日历插件配置和调用-->
		<script type="text/javascript" src="../../js/jquery.validationEngine-zh_CN.js" ></script>
		<script type="text/javascript" src="../../js/jquery.validationEngine.js" ></script>
		<script type="text/javascript" src="../../js/member/echo_member_base.js"></script>		
		<script type="text/javascript" src="../../js/jquery.ganged.js"></script><!-- 省市区联动 s -->
		<script type="text/javascript" src="../../js/pro.js"></script><!--  省市区的json数据 -->
		<script type="text/javascript" src="../../js/ajaxFileUpload.full.js" ></script>
		<script type="text/javascript" src="../../js/jquery.cookie.js" charset="utf-8"></script>
		<script type="text/javascript" src="../../js/jquery.joyride-2.1.js"></script> <!--向导 -->
		<script type="text/javascript" src="../../js/jquery.placeholder.js"  charset="utf-8"></script><!-- placehoder兼容 -->
		<!--[if lt IE 10]>
			<script type="text/javascript">
				$(function() {
				      $('input, textarea').placeholder({force: true});
				});
			</script>
		<![endif]-->
		<script type="text/javascript">
			var sex1 = 0;
			$(window).load(function() {
				var aElement = window.parent.document.getElementById("paramAccountId");
				var accountId = "0";
				if(aElement != null){
					accountId = aElement.value;
				}
				var cookieName = "_new_mem_" + accountId;
				if($.cookie(cookieName)  == null){
					// 功能引导 调用
			        $('#joyRideTipContent').joyride({
						tipLocation:"right",
						autoStart : true,
						modal:true,
						expose: true,
						cookieName: cookieName,
						cookieMonster: true
					});
				}
			});
		
			$(function(){
				$("#nameErrorMsg").remove();
				$("#idErrorMsg").remove();
				var idCard = $("#id_card1").val();
				if(idCard != null && idCard != ""){
					$("#birthday1").val(idCard.substring(6,10) + "-" + idCard.substring(10,12) + "-" + idCard.substring(12,14));
				}
				
				$("#member_load").click(function(){
					showPop(null, "dialog_1");
					idCardMsgRead();
				});
				
				$("#myFile").live("change", function() {
					var fileName = $(this).val();
					var fileType = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length);
					var regex = /^(bmp|jpg|png|gif)$/g
					if(!regex.test(fileType)){
						zhyAlert("请您上传正确格式的图片，当前支持格式为：.bmp;.jpg;.png;.gif;");
						return false;
					}
			        myFileUpload();
				});
				
				$(":radio").click(function(){
					var postionNumber1 = $("#id_card1").val();
					if($("#idType .dropdown-text").attr("value") !== "0"){
						return false;
					}
					
					if (postionNumber1 != null && (postionNumber1.length == 15 || postionNumber1.trim().length==18)){
						var pLen = postionNumber1.trim().length;
						var sex_flag = pLen == 15 ? postionNumber1.substring(pLen - 1,pLen) : postionNumber1.substring(pLen - 2,pLen - 1) ;
						if(sex_flag == "1" || sex_flag == "3" || sex_flag == "5" || sex_flag == "7" || sex_flag == "9"){
							if($("input[type=radio][value=1]").attr("checked") != "checked" || !$("input[type=radio][value=1]").attr("checked")){
								zhyAlert("根据身份证信息判断该长者为男性");
								$("input[type=radio][value=1]").attr("checked", true);
								$("input[type=radio][value=1]").parent().attr("class","label_radio r_on");
								$("input[type=radio][value=0]").parent().attr("class","label_radio");
								sex1 = 1;
							}
						}else{
							if($("input[type=radio][value=0]").attr("checked") != "checked" || !$("input[type=radio][value=0]").attr("checked")){
								zhyAlert("根据身份证信息判断该长者为女性");
								$("input[type=radio][value=0]").attr("checked", true);
								$("input[type=radio][value=0]").parent().attr("class","label_radio r_on");
								$("input[type=radio][value=1]").parent().attr("class","label_radio");
								sex1 = 0;
							}
						}
					}
				});
				
				$("#name1").blur(function(){
					if(!validName()){
						return false;
					}
				});
			});
			
			function validName(){
				var val = $.trim($("#name1").val());
				var errorMsg = "<div id=\"nameErrorMsg\" class=\"nameformError parentFormadd_jd_from formError inline\" style=\"opacity: 0.87; position: relative; top: 0px; left: 0px; margin-top: 0px;\">" + 
					"<div class=\"formErrorContent\">" + 
					"<img class=\"formErrorImg\" src=\"../../img/error_sm.png\">" + 
					"<font>只能填写中文汉字</font></div></div>";
					
				if(val == null || val == "" || val.length == 0){
					if($("#nameErrorMsg").length == 0){
						$("#name1").parent().append(errorMsg);
					}
					$("#nameErrorMsg font").html("此处不可空白");
					return false;
				}
				
				if(!/^[\u4E00-\u9FA5A-Za-z0-9]{2,8}$/g.test(val)){
					if($("#nameErrorMsg").length == 0){
						$("#name1").parent().append(errorMsg);
					}
					$("#nameErrorMsg font").html("请填写2-8位中文、字母、数字");
					return false;
				}
				
				$("#nameErrorMsg").remove();
				return true;
			}
			
			function validPostionNumber(){
				var val = $.trim($("#id_card1").val());
				if($("#idType .dropdown-text").attr("value") !== "0" && val != null && val.length <= 18){
					return true;
				}
				
				if($("#idType .dropdown-text").attr("value") !== "0" && val != null && val.length > 18){
					zhyAlert("证件号码不能大于18位字符");
					return false;
				}
				
				var errorMsg = "<div id=\"idErrorMsg\" class=\"nameformError parentFormadd_jd_from formError inline\" style=\"opacity: 0.87; position: relative; top: 0px; left: 0px; margin-top: 0px;\">" + 
					"<div class=\"formErrorContent\">" + 
					"<img class=\"formErrorImg\" src=\"../../img/error_sm.png\">" + 
					"<font>只能填写中文汉字</font></div></div>";
				
				var regex = /^[1-9]\d{5}[1-9]\d{3}(((0[13578]|1[02])(0[1-9]|[12]\d|3[0-1]))|((0[469]|11)(0[1-9]|[12]\d|30))|(02(0[1-9]|[12]\d)))(\d{4}|\d{3}[xX])$/g;
				if(val != null && val != "" && !regex.test(val)){
					if($("#idErrorMsg").length == 0){
						$("#id_card1").parent().append(errorMsg);
					}
					$("#idErrorMsg font").html("请填写正确的身份证号");
					return false;
				}
				
				$("#idErrorMsg").remove();
				return true;
			}
		
			/****省市区联动 调用******/
			$("[id^='jsAddress']").ganged({'data': provinceList, 'width': 133, 'height': 32});
			
			$("#old").validationEngine(); 
			$("#fam").validationEngine(); 
			//新增长者
		  	$(".nav_head li").click(function(){
		  		var eq = $(this).index();
		  		$(this).addClass("on").siblings().removeClass("on");
		  		if(eq == 0){
		  			$(".old_block").show().siblings(".fam_block").hide();;
		  		}else{
		  			$(".fam_block").show().siblings(".old_block").hide();;
		  		}
		  	});
			
		  	function site_add_new(obj){
		  		var str='<div class=" relative" style="margin-top:15px">'+
		  		'<input type="text" class="form-control input300 dropdown-text" '+
		  		'onkeyup="showRelationMember2(this,this.value)" name="relation_famliy" memberId=""  placeholder="关联亲友">'+
		  		'<i class="delete_icon" onclick="removeItem(this)"></i><ul class="dropdown-menu-ajax" style="left:0px;"></ul></div>';
		  		$(obj).parent().append(str);
		  	}
		  	
			function removeItem(obj){
		  		$(obj).parent().remove();//删除
		  	}
			
			$("#id_card1").blur(function(){
				if(!validPostionNumber()){
					return false;
				}
				
				if($("#idType .dropdown-text").attr("value") !== "0"){
					return false;
				}
				
				var postionNumber1 = $("#id_card1").val();
				//证件号码
				if (postionNumber1 != null && (postionNumber1.length == 15 || postionNumber1.trim().length==18)){
					var pLen = postionNumber1.trim().length;
					var sex_flag = pLen == 15 ? postionNumber1.substring(pLen - 1,pLen) : postionNumber1.substring(pLen - 2,pLen - 1) ;
					if(sex_flag == "1" || sex_flag == "3" || sex_flag == "5" || sex_flag == "7" || sex_flag == "9"){
						$("#woman1").parent().attr("class","label_radio");
						$("#man1").parent().attr("class","label_radio r_on");
						$("#man1").attr("checked",true);
						$("#woman1").removeAttr("checked");
						sex1 = 1;
					}else{
						$("#man1").parent().attr("class","label_radio");
						$("#woman1").parent().attr("class","label_radio r_on");
						$("#woman1").attr("checked",true);
						$("#man1").removeAttr("checked");
						sex1 = 0;
					}
				}
			});
			
			//身份证信息读取
			function idCardMsgRead(){
				$.ajax({
					type: "get",
		            async: false,
					dataType: "jsonp",
					url: "http://127.0.0.1:21250/api/hsidcard",
					jsonp: "callback",
					timeout: 5000,
					success:function(json){
						if(json.state == 1){
							$("#name1").val(json.data.name);
							$("#name1").blur();
							$("#id_card1").val(json.data.idCard);
							if(json.data.sex == "男"){
								$("#man1").attr("checked", true);
								$("#man1").parent().addClass("r_on");
								$("#woman1").attr("checked", false);
								$("#woman1").parent().removeClass("r_on");
							}else{
								$("#man1").attr("checked", false);
								$("#man1").parent().removeClass("r_on");
								$("#woman1").attr("checked", true);
								$("#woman1").parent().addClass("r_on");
							}
							$("#birthday1").val(json.data.birthday);
							$("#birthday1").blur();
							uploadBase64(json.data.pic);
						}else if(json.state == 0){
							hidePop();
							zhyAlert(json.message);
						}
					}
				});
				
				var head = document.head || $('head')[0] || document.documentElement;
				var script = $(head).find('script')[0];
				script.onerror = function(evt){
					hidePop();
					zhyAlert("信息读取失败！");
				};
			}
			
			//上传身份证图片
			function uploadBase64(avatar){
				$.ajax({
					type: "POST",
					dataType: "json",
					url: "${ctx}/imageUpload/uploadBase64",
					data: {
						base64: avatar
					},
					success:function(data){
						if (data.rs == -1){
							zhyAlert(data.msg);
							return;
						}
						
						if (data[0].paths[0].rs == -1){
							zhyAlert(data.paths[0].msg);
							return;
						}
						
						hidePop();
						$("#avatar_url").attr("src",data[0].paths[0].url);
						$("#avatar_url1").val(data[0].paths[0].url);
						$("#myFile").val("");
					}
				});
			}
			
			function myFileUpload(){
			    $.ajaxFileUpload({
			        url: "${ctx}/imageUpload/upload_file", 
			        data:{lineType:"klh"},
			        secureuri: false, //一般设置为false
			        fileElementId: "myFile",
			        dataType:'json',
			       	success: function (data, status){
			            uploadCallbacks(data[0]);
			        },
			        error: function (data, status, e){
			        	zhyAlert(e);
			        }
			    });
			}

			function uploadCallbacks(data){
				if (data.rs == -1){
					zhyAlert(data.msg);
					return;
				}
				
				if (data.paths[0].rs == -1){
					zhyAlert(data.paths[0].msg);
					return;
				}
				
				$("#avatar_url").attr("src",data.paths[0].url);
				$("#avatar_url1").val(data.paths[0].url);
				$("#myFile").val("");
			}
			
			//显示弹框
			function showPop(obj,className,id){
				$(".zhy_zhezhao_pop").show();
				var top = document.body.scrollTop||document.documentElement.scrollTop;
				var this_h = $("." + className).height();
				var win_h = ($('html',parent.document).height()-this_h-100)/2
				$(".zhy_zhezhao_pop").height($("html").height());
				var this_h = $("." + className).height();
				top = top + win_h;
				$("." + className).show();
			}
			
			// 隐藏修改弹框
			function hidePop() {
				$(".zhy_zhezhao_pop").hide();
				$(".zhy_popa").hide();
			}
			
			//激活长者，填写详细资料---0,跳转列表页;1,跳转填写详细信息页
			var activate_mark = 0;
			// 长者基本信息保存---跳转列表页
			$("#member_add").click(function(){
				if(!validName()){
					return false;
				}
				
				setTimeout('$("#old").validationEngine("validate")',500);
				if($(".formErrorContent").length > 0){
					$(this).removeAttr("disabled");
					return false;
				}
				
				if($(this).attr("disabled") === "disabled" || $(this).attr("disabled")){
					return false;
				}
				
				$(this).attr("disabled", true);
				activate_mark = 0;
				setTimeout("save_member_base()", 1000);
			});
			
			// 长者基本信息保存---跳转填写详细信息页
			$("#perfect_member").click(function(){
				setTimeout('$("#old").validationEngine("validate")',500);
				if($(".formErrorContent").length > 0){
					return false;
				}
				activate_mark = 1;
				save_member_base();
			});

			//添加长者-保存
			function save_member_base(){
				/* if($("input[name='area']").val() == -1){
					zhyAlert("请选择居住地址");
					$("#member_add").removeAttr("disabled");
					return;
				} */
				
				if($("input[name='province']").val() == -1){
					zhyAlert("请选择居住省");
					$("#member_add").removeAttr("disabled");
					return;
				}
				
				if($("input[name='city']").val() == -1){
					zhyAlert("请选择居住市");
					$("#member_add").removeAttr("disabled");
					return;
				}
				
				if($("#juzhu_address1").val().length >= 32){
					zhyAlert("详细地址长度应小于32");
					$("#member_add").removeAttr("disabled");
					return;
				}
				
				var errLen = $("#old").find(".formErrorContent").length;
				if(errLen > 0){
					//zhyAlert("表单验证错误，请修改后保存");
					$("#member_add").removeAttr("disabled");
					return;
				}
				
				var transform_state = "0";
				if($("#transform_state1").length == 1 && $("#transform_state1").val() != null && $("#transform_state1").val() != ""){
					transform_state = $("#transform_state1").val();
				}
				
				var avatar = "";
				if($("#avatar_url1").length == 1 && $("#avatar_url1").val() != null && $("#avatar_url1").val() != ""){
					avatar = $("#avatar_url1").val();
				}
				
				var telphone = "";
				if($("#telphone").length > 0 && $("#telphone").val() != null && $("#telphone").val() != ""){
					telphone = $.trim($("#telphone").val());
				}
                window.location = "member_show.jsp";
				$.ajax({
					type: "post",
					dataType: "json",
					url: "${ctx}/member/save_unactivated_member",
					async: true,
					data: {
						memberId: $("#member_id1").val(),
						transformState: transform_state,
						name: $("#name1").val(),
						serverStationCode: $("#server_station_code").val(),
						postionNumber: $("#id_card1").val(),
						sex: $("input[type=radio]:checked").attr("value"),
						birthdayStr: $("#birthday1").val(),
						phone: $("#phone1").val(),
						resideProvince: $("#old").find(":input[name='province']").val(),
						resideCity: $("#old").find(":input[name='city']").val(),
						resideArea: $("#old").find(":input[name='area']").val(),
						resideAddress: $("#juzhu_address1").val(),
						avatar: avatar,
						telphone: telphone,
						grade: 1,
						selfCareBase: $("#selfCareBase").val(),
						IDType: $("#idType .dropdown-text").attr("value")
					},
					success: function(data){
						if(data.resultCode === "SUCC"){
							$("#member_add").attr("disabled", true);
							//激活长者，填写详细资料
							if(activate_mark == 1){
								window.location = "${ctx}/member/update_member_jsp?memberId="+data.data;
							}else{
								if($("#transform_state1").length > 0){
									window.location = "${ctx}/reception/get_member_jd_list?station=" + $("#server_station_code").val() + "&transform_state=1";
								}else{
									window.location = "${ctx}/member/get_member_list?station=" + $("#server_station_code").val();
								}
							}
						}else{
							$("#member_add").removeAttr("disabled");
							zhyAlert(data.failureMessage);
						}
					}
				});
			}
			//长者取消保存信息
			$("#member_exit").click(function(){
                window.location = "member_list.html";
			});
			
			function id_birthday(idName,birthdayName){
				if($("#idType .dropdown-text").attr("value") !== "0"){
					return;
				}
				
				var postionNumber = $("#"+idName).val();
				//18位身份證號
				if(postionNumber!=null&&postionNumber.trim().length==18){
					$("#"+birthdayName).val(postionNumber.substring(6,10)+"-"+postionNumber.substring(10,12)+"-"+postionNumber.substring(12,14)).blur();
				}
				//15位身份证号码
				if (postionNumber!=null&&postionNumber.length==15){
					var birthdayValue = postionNumber.substring(6,8);
					if (parseInt(birthdayValue) < 10) {
						birthdayValue = '20' + birthdayValue;
					}else{
						birthdayValue = '19' + birthdayValue;
					}
					birthdayValue = birthdayValue + '-' + postionNumber.substring(8,10) + '-' + postionNumber.substring(10,12);
					$("#"+birthdayName).val(birthdayValue).blur(); 
				}
			}
			
			function setJoyRide(){
				var left = $(window).width()-450;
	            $("#setjoyRide").css("marginLeft",left/2);
			}
			
			setJoyRide();
			$(window).resize(function(){
				setJoyRide();
			});
		</script>
	</body>
</html>